package com.taoym.voucher.xcx.controller;

import com.taoym.voucher.common.response.Response;
import com.taoym.voucher.xcx.entity.vo.XcxGetTextVO;
import com.taoym.voucher.xcx.service.XcxTextService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.validation.constraints.NotNull;
import java.util.List;

/**
 * @coder taoym
 * @datetime 2021/8/17 14:29
 * @desc
 */
@RestController
@RequestMapping("/text")
@Api(tags = "小程序文本控制器")
@Validated
public class XcxTextController {

    @Autowired
    private XcxTextService xcxTextService;

    @GetMapping("/list")
    @ApiOperation("查询小程序文本")
    public Response<List<XcxGetTextVO>> listTexts(@RequestParam @NotNull(message = "文本类型不能为空") Integer type) {
        return Response.success(xcxTextService.getXcxTexts(type));
    }
}
